//!@author denglibin
//!@date 2025/11/4 10:47
//!@desc

use my_trait::MustHaveFieldType;
use my_trait::MustHaveTableName;
use my_trait::Struct2Map;

use derive_builder::Builder;
use proc_macro::{table_name, GetFieldNames, HaveFieldType, StructToMap};
use serde::{Deserialize, Serialize};
use sqlx::FromRow;


/*
CREATE TABLE `tian_fu_doc_2` (
  `id` int NOT NULL AUTO_INCREMENT,
  `doc_id` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `title` text COLLATE utf8mb4_unicode_ci,
  `content` longtext COLLATE utf8mb4_unicode_ci,
  `publish_date` bigint,
  `original` varchar(2048),
  `system_name` varchar(2048),
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
*/

#[derive(
    Debug, FromRow, Serialize, Deserialize, Builder, GetFieldNames, StructToMap, HaveFieldType,
)]
#[table_name("tian_fu_doc_2")]
pub struct TianFuDoc {
    pub doc_id: String,
    pub title: String,
    pub content: String,
    pub publish_date: Option<i64>,
    pub original: Option<String>,
    pub system_name: Option<String>,
}




#[derive(
    Debug, FromRow, Serialize, Deserialize, Builder, GetFieldNames, StructToMap, HaveFieldType,
)]
#[table_name("tian_fu_doc_2")]
pub struct TianFuIdDoc {
    pub id: i64,
    pub doc_id: String,
    pub title: String,
    pub content: String,
    pub publish_date: Option<i64>,
    pub original: Option<String>,
    pub system_name: Option<String>,
}
